3.2.57 \(\int \cot ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\) [157]

Optimal. Leaf size=78 \[ -a^2 x+\frac {b^2 x}{2}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

-a^2*x+1/2*b^2*x-2*a*b*arctanh(cos(d*x+c))/d+2*a*b*cos(d*x+c)/d-a^2*cot(d*x+c)/d+1/2*b^2*cos(d*x+c)*sin(d*x+c)
/d

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2801, 2715, 8, 2672, 327, 212, 3554} \begin {gather*} -\frac {a^2 \cot (c+d x)}{d}+a^2 (-x)+\frac {2 a b \cos (c+d x)}{d}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {b^2 \sin (c+d x) \cos (c+d x)}{2 d}+\frac {b^2 x}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

-(a^2*x) + (b^2*x)/2 - (2*a*b*ArcTanh[Cos[c + d*x]])/d + (2*a*b*Cos[c + d*x])/d - (a^2*Cot[c + d*x])/d + (b^2*
Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 2801

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Int[Expan
dIntegrand[(g*Tan[e + f*x])^p, (a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2
, 0] && IGtQ[m, 0]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps

\begin {align*} \int \cot ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=\int \left (b^2 \cos ^2(c+d x)+2 a b \cos (c+d x) \cot (c+d x)+a^2 \cot ^2(c+d x)\right ) \, dx\\ &=a^2 \int \cot ^2(c+d x) \, dx+(2 a b) \int \cos (c+d x) \cot (c+d x) \, dx+b^2 \int \cos ^2(c+d x) \, dx\\ &=-\frac {a^2 \cot (c+d x)}{d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{2 d}-a^2 \int 1 \, dx+\frac {1}{2} b^2 \int 1 \, dx-\frac {(2 a b) \text {Subst}\left (\int \frac {x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a^2 x+\frac {b^2 x}{2}+\frac {2 a b \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{2 d}-\frac {(2 a b) \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a^2 x+\frac {b^2 x}{2}-\frac {2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {b^2 \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.28, size = 116, normalized size = 1.49 \begin {gather*} \frac {-4 a^2 c+2 b^2 c-4 a^2 d x+2 b^2 d x+8 a b \cos (c+d x)-2 a^2 \cot \left (\frac {1}{2} (c+d x)\right )-8 a b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+8 a b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+b^2 \sin (2 (c+d x))+2 a^2 \tan \left (\frac {1}{2} (c+d x)\right )}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

(-4*a^2*c + 2*b^2*c - 4*a^2*d*x + 2*b^2*d*x + 8*a*b*Cos[c + d*x] - 2*a^2*Cot[(c + d*x)/2] - 8*a*b*Log[Cos[(c +
 d*x)/2]] + 8*a*b*Log[Sin[(c + d*x)/2]] + b^2*Sin[2*(c + d*x)] + 2*a^2*Tan[(c + d*x)/2])/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.15, size = 79, normalized size = 1.01

method result size
derivativedivides \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 a b \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(79\)
default \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 a b \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(79\)
risch \(-a^{2} x +\frac {b^{2} x}{2}-\frac {i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {a b \,{\mathrm e}^{i \left (d x +c \right )}}{d}+\frac {a b \,{\mathrm e}^{-i \left (d x +c \right )}}{d}+\frac {i b^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}-\frac {2 i a^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}\) \(140\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2*(a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*(-cot(d*x+c)-d*x-c)+2*a*b*(cos(d*x+c)+ln(csc(d*x+c)-cot(d*x+c)))+b^2*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d
*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.50, size = 79, normalized size = 1.01 \begin {gather*} -\frac {4 \, {\left (d x + c + \frac {1}{\tan \left (d x + c\right )}\right )} a^{2} - {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2} - 4 \, a b {\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/4*(4*(d*x + c + 1/tan(d*x + c))*a^2 - (2*d*x + 2*c + sin(2*d*x + 2*c))*b^2 - 4*a*b*(2*cos(d*x + c) - log(co
s(d*x + c) + 1) + log(cos(d*x + c) - 1)))/d

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 118, normalized size = 1.51 \begin {gather*} -\frac {b^{2} \cos \left (d x + c\right )^{3} + 2 \, a b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 2 \, a b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right ) + {\left ({\left (2 \, a^{2} - b^{2}\right )} d x - 4 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \sin \left (d x + c\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*cos(d*x + c)^3 + 2*a*b*log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) - 2*a*b*log(-1/2*cos(d*x + c) + 1/2)
*sin(d*x + c) + (2*a^2 - b^2)*cos(d*x + c) + ((2*a^2 - b^2)*d*x - 4*a*b*cos(d*x + c))*sin(d*x + c))/(d*sin(d*x
 + c))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sin {\left (c + d x \right )}\right )^{2} \cot ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2*(a+b*sin(d*x+c))**2,x)

[Out]

Integral((a + b*sin(c + d*x))**2*cot(c + d*x)**2, x)

________________________________________________________________________________________

Giac [A]
time = 14.78, size = 148, normalized size = 1.90 \begin {gather*} \frac {4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - {\left (2 \, a^{2} - b^{2}\right )} {\left (d x + c\right )} - \frac {4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} - \frac {2 \, {\left (b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, a b\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/2*(4*a*b*log(abs(tan(1/2*d*x + 1/2*c))) + a^2*tan(1/2*d*x + 1/2*c) - (2*a^2 - b^2)*(d*x + c) - (4*a*b*tan(1/
2*d*x + 1/2*c) + a^2)/tan(1/2*d*x + 1/2*c) - 2*(b^2*tan(1/2*d*x + 1/2*c)^3 - 4*a*b*tan(1/2*d*x + 1/2*c)^2 - b^
2*tan(1/2*d*x + 1/2*c) - 4*a*b)/(tan(1/2*d*x + 1/2*c)^2 + 1)^2)/d

________________________________________________________________________________________

Mupad [B]
time = 7.27, size = 277, normalized size = 3.55 \begin {gather*} \frac {b^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+4\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )-2\,a^2\,\mathrm {atan}\left (\frac {-2\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+4\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}{2\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+4\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^2}\right )+2\,a\,b\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a^2\,\cos \left (c+d\,x\right )-\frac {b^2\,\cos \left (c+d\,x\right )}{8}+\frac {b^2\,\cos \left (3\,c+3\,d\,x\right )}{8}-a\,b\,\sin \left (2\,c+2\,d\,x\right )}{d\,\sin \left (c+d\,x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^2*(a + b*sin(c + d*x))^2,x)

[Out]

(b^2*atan((b^2*cos(c/2 + (d*x)/2) - 2*a^2*cos(c/2 + (d*x)/2) + 4*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2 + (d*x
)/2) - b^2*sin(c/2 + (d*x)/2) + 4*a*b*cos(c/2 + (d*x)/2))) - 2*a^2*atan((b^2*cos(c/2 + (d*x)/2) - 2*a^2*cos(c/
2 + (d*x)/2) + 4*a*b*sin(c/2 + (d*x)/2))/(2*a^2*sin(c/2 + (d*x)/2) - b^2*sin(c/2 + (d*x)/2) + 4*a*b*cos(c/2 +
(d*x)/2))) + 2*a*b*log(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d - (a^2*cos(c + d*x) - (b^2*cos(c + d*x))/8 +
(b^2*cos(3*c + 3*d*x))/8 - a*b*sin(2*c + 2*d*x))/(d*sin(c + d*x))

________________________________________________________________________________________